Remove the old icon cache if regenerating it would cause it to be empty
authorFederico Mena Quintero <federico@novell.com>
Fri, 18 Jul 2008 19:28:13 +0000 (19:28 +0000)
committerFederico Mena Quintero <federico@src.gnome.org>
Fri, 18 Jul 2008 19:28:13 +0000 (19:28 +0000)
Signed-off-by: Federico Mena Quintero <federico@novell.com>
svn path=/trunk/; revision=20865

ChangeLog
gtk/updateiconcache.c

index 77880c82de3f2719e3fa6c6d04fead2abee149e2..641533ab5d3348e6315b85d0e76601317cf78d5c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        *  gdk/directfb/gdkvisual-directfb.c: Avoid a crash in
        _gdk_visual_init().  Patch by Huimin He.
 
+2008-07-18  Federico Mena Quintero  <federico@novell.com>
+
+       * gtk/updateiconcache.c (build_cache): If the resulting cache file
+       would be empty, erase the old cache file as well as the temporary file.
+
 2008-07-18  Federico Mena Quintero  <federico@novell.com>
 
        * demos/gtk-demo/changedisplay.c (find_toplevel_at_pointer): Don't
index b239cc3029894de0f90a7fcb89ec003b8bae12ea..0f5577a25b1fdfed7902f08f7e3c8a05094c440c 100644 (file)
@@ -1448,6 +1448,7 @@ build_cache (const gchar *path)
 #endif
 
   tmp_cache_path = g_build_filename (path, "."CACHE_NAME, NULL);
+  cache_path = g_build_filename (path, CACHE_NAME, NULL);
 
   if ((fd = g_open (tmp_cache_path, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC | _O_BINARY, mode)) == -1)
     {
@@ -1476,6 +1477,7 @@ build_cache (const gchar *path)
 
       fclose (cache);
       g_unlink (tmp_cache_path);
+      g_unlink (cache_path);
       exit (0);
     }
     
@@ -1499,8 +1501,6 @@ build_cache (const gchar *path)
       exit (1);
     }
 
-  cache_path = g_build_filename (path, CACHE_NAME, NULL);
-
 #ifdef G_OS_WIN32
   if (g_file_test (cache_path, G_FILE_TEST_EXISTS))
     {